package shoot;

import java.awt.*;
import java.awt.image.BufferedImage;

/**
 * 天空
 */
public class Sky extends FlyingObject {
    private int y;
    private int y1;
    private int speed;

    public  static BufferedImage images;
    static{
        images=loadImage("sky.jpg");
    }


    public Sky(){
        super(World.WIDTH,World.HEIGHT,0,0);
        speed=2;
        y=0;
        y1=-World.HEIGHT;
    }

    @Override
    public BufferedImage getImage() {
        return images;
    }
    
    @Override
    public void paintObject(Graphics g) {
    	// TODO Auto-generated method stub
    	g.drawImage(getImage(), 0, y, null);
    	g.drawImage(getImage(), 0, y1, null);
    }
    
    @Override
    public void step() {
    	// TODO Auto-generated method stub
    	y+=speed;
    	y1+=speed;
    	if (y>=World.HEIGHT) {
			y=-World.HEIGHT;
		}
    	if (y1>=World.HEIGHT) {
			y1=-World.HEIGHT;
		}
    }
    
}
